"""Location model and utilities."""
from typing import Optional
from pydantic import BaseModel, Field


class Location(BaseModel):
    """Location data model."""
    
    latitude: float = Field(..., ge=-90, le=90)
    longitude: float = Field(..., ge=-180, le=180)
    altitude: Optional[float] = None
    accuracy: float = Field(..., gt=0)
    
    class Config:
        """Pydantic config."""
        json_schema_extra = {
            "example": {
                "latitude": 39.9042,
                "longitude": 116.4074,
                "altitude": 50.0,
                "accuracy": 10.0
            }
        }
